package com.front.common;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils extends org.apache.commons.lang.time.DateUtils{

	public static SimpleDateFormat timeformat=new SimpleDateFormat("HH:mm:ss");
	public static SimpleDateFormat dateformat=new SimpleDateFormat("yyyy-MM-dd");
	public static SimpleDateFormat dateShortFormat=new SimpleDateFormat("yyyyMMdd");
	private static SimpleDateFormat shorttimeformat = new SimpleDateFormat("HH:mm");
	
	/**
	 * 
	 * @param date
	 * @return
	 */
	public static Date getTimeWithoutDate(String date){
		try {
			return shorttimeformat.parse(date);
		} catch (ParseException e) {
			return null;
		}
	}
	
	/***
	 * 
	 * @return
	 */
	public static Date createTimeWithoutDate(){
		try {
			return shorttimeformat.parse(shorttimeformat.format(new Date()));
		} catch (ParseException e) {
			return null;
		}
	}
	
	public static String getTimeString(Date date){
		return timeformat.format(date);
	}
	
	public static String getDateString(Date date){
		return dateformat.format(date);
	}
	
	public static String getShortDateString(Date date){
		return dateShortFormat.format(date);
	}
}
